import {createI18n} from 'vue-i18n'

import elementEnLocale from 'element-plus/es/locale/lang/en'
import elementZhLocale from 'element-plus/es/locale/lang/zh-cn'
import enLocale from './en'
import zhLocale from './zh'
import AvueEnLocale from 'components/avue/locale/lang/en'
import AvueZhLocale from 'components/avue/locale/lang/zh'
import pinia from "@/stores";
import useCommonStore from "@/stores/useCommonStore";

const commonStore = useCommonStore(pinia);
export const messages = {
    en: {
        ...enLocale,
        ...AvueEnLocale,
        ...elementEnLocale
    },
    'zh-cn': {
        ...zhLocale,
        ...AvueZhLocale,
        ...elementZhLocale,
    },

}
export const language = commonStore.language
export default createI18n({
    locale: commonStore.language,
    messages,
});
